GtkExpander: Fix a problem with resize-toplevel
authorMatthias Clasen <mclasen@redhat.com>
Thu, 2 Oct 2014 22:02:11 +0000 (18:02 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 2 Oct 2014 22:06:02 +0000 (18:06 -0400)
The toplevel resizing was not working properly when the
content had non-trivial height-for-width behavior (such
as a wrapping label).

gtk/gtkexpander.c

index e8bf4b8d9c1f3ba51fc454d295ce1334cf547ee7..030f5a87ad1b9bdc34b4717f21303ba20bbae3d0 100644 (file)
@@ -1244,23 +1244,21 @@ gtk_expander_resize_toplevel (GtkExpander *expander)
       if (toplevel && gtk_widget_get_realized (toplevel))
         {
           GtkAllocation toplevel_allocation;
+          GtkAllocation child_allocation;
 
           gtk_widget_get_allocation (toplevel, &toplevel_allocation);
+          gtk_widget_get_allocation (child, &child_allocation);
 
           if (priv->expanded)
             {
               GtkRequisition child_requisition;
 
-              gtk_widget_get_preferred_size (child, &child_requisition, NULL);
+              gtk_widget_get_preferred_height_for_width (child, child_allocation.width, &child_requisition.height, NULL);
 
               toplevel_allocation.height += child_requisition.height;
             }
           else
             {
-              GtkAllocation child_allocation;
-
-              gtk_widget_get_allocation (child, &child_allocation);
-
               toplevel_allocation.height -= child_allocation.height;
             }